package com.mazaiting.manager.convert;

import com.mazaiting.manager.domain.entity.SysPermission;
import com.mazaiting.manager.domain.form.PermForm;
import com.mazaiting.manager.domain.vo.permission.PermDetailVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;

/**
 * 权限实体转换器
 *
 * @author mazaiting
 * @create_time 2022/9/23 19:21
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface IPermissionConverter {

    /**
     * 权限表单转换为实体
     * @param permForm 权限表单
     * @return 实体
     */
    SysPermission form2Entity(PermForm permForm);


    /**
     * 权限表单注入到实体
     * @param permForm 权限表单
     * @param sysPermission 系统权限
     */
    void form2Entity(PermForm permForm, @MappingTarget SysPermission sysPermission);

    /**
     * 数据库实体转换为权限详情 VO
     * @param sysPermission 数据库权限实体
     * @return 权限详情 VO
     */
    PermDetailVO entity2VO(SysPermission sysPermission);
}
